{% extends 'base.html' %}

{% block title %}
  {{ title }} :: {{ block.super }}
{% endblock %}

{% block sidebar %}
  {% include 'inc/_sidebar.html' %}
{% endblock %}

{% block content %}
    {% for item in news %}
      <div class="card mb-3">
        <div class="card-header">
          Категория: <a href="{{ item.category.get_absolute_url }}">{{ item.category.title }}</a>
        </div>
        <div class="card-body">
          <div class="media">
            {% if item.photo %}
              <img src="{{ item.photo.url }}" alt="" width="350" class="mr-3">
            {% else %}
              <img src="https://picsum.photos/id/1060/350/235/?blur=2" alt="">
            {% endif %}
            <div class="media-body">
              <h5 class="card-title {% cycle 'text-danger' ' text-success' %}">{{ item.title }}</h5>
              <p class="card-text">{{ item.content|linebreaks }}</p>
              <a href="{{ item.get_absolute_url }}" class="btn btn-primary">Read more...</a>
            </div>
          </div>
        </div>
        <div class="card-footer text-muted">
          {{ item.created_at|date:"Y-m-d H:i:s" }}
        </div>
      </div>
    {% endfor %}
{% endblock %}



